package com.woniuxy.hospital.mapper;

import com.woniuxy.hospital.entity.HplHospitalizationList;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2021-08-12
 */
public interface HplHospitalizationListMapper extends BaseMapper<HplHospitalizationList> {
    @Select("select * from hpl_hospitalization_list hl,hpl_doctor d,hpl_patient p where hl.doctor_id=d.id and hl.patient_id=p.id and hl.status=#{status}")
    @Results({
            @Result(id = true,column = "id",property = "id"),
            @Result(property = "patient",column = "patient_id",one = @One(select = "com.woniuxy.hospital.mapper.HplPatientMapper.selectById")),
            @Result(property = "doctor",column = "doctor_id" ,one = @One(select = "com.woniuxy.hospital.mapper.HplDoctorMapper.selectById"))
    })
    List<HplHospitalizationList> getByStatue(String status);
}
